<?php

namespace App\Listeners;

use App\Events\SettingLogEvent;
use App\Models\SettingLog;

class SettingLogEventListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  AuthStepEventListener  $event
     * @return void
     */
    public function handle(SettingLogEvent $event)
    {
        $post = $event->post;
        if($post && is_array($post)){
            try{
                SettingLog::create($post);
            }catch (\Exception $e){
                \Log::debug('后台写入设置操作失败：'.$e->getMessage());
            }
        }
    }
}